﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KinSocket;

namespace KinConquer.Packets.Structures
{
    public unsafe struct DataPacket
    {
        public UInt16 Size;
        public UInt16 Type;
        public UInt32 Identifier;
        public UInt32 dwParam;
        public UInt32 dwParam1;
        public Native.TIME TimeStamp;
        public DataTypes DataType;
        public UInt16 wParam0;
        public UInt16 wParam1;
        public UInt16 wParam2;

        public static DataPacket Create()
        {
            DataPacket packet = new DataPacket();
            packet.Size = 0x2D;
            packet.Type = 0x271A;
            packet.TimeStamp = Native.TIME.Now;
            return packet;
        }

        public enum DataTypes : ushort
        {
            ViewEquipment2 = 54,
            SetLocation = 74,
            Hotkeys = 75,
            ConfirmFriends = 76,
            ConfirmProficiencies = 77,
            ConfirmSpells = 78,
            ChangeDirection = 79,
            ChangeAction = 81,
            UsePortal = 85,
            Teleport = 86,
            Leveled = 92,
            Revive = 94,
            ChangePKMode = 96,
            ConfirmGuild = 97,
            Mine = 99,
            InvisibleEntity = 102,
            MapColor = 104,
            TeamateLoc = 106,
            NewCoordonates = 108,
            RemoveSpell = 109,
            Vend = 111,
            GetSurroundings = 114,
            OpenCustom = 116,
            ViewEquipment = 117,
            RemoveDisguise = 118,
            EndFlying = 120,
            GoldPickup = 121,
            ViewEnemyInfo = 123,
            OpenWindow = 126,
            CompleteLoginOld = 132,
            RemoveEntity = 135,
            Jump = 137,
            EndTeleport = 146,
            ViewFriendInfo = 148,
            ChangeFace = 151,
            ViewTradePartnerInfo = 152,
            ItemsDetained = 154,
            DetainItems = 155,
            Shift = 156,
            HideInterface = 158,
            BlueCountdown = 159,
            NpcSpecial = 160,
            Away = 161,
            PathFind = 162,
            SpellBar = 164,
            MobDropsDragonball = 165,
            CompleteLogin = 251,
        }

        public enum WindowTypes : uint
        {
            Compose = 1,
            Craft1 = 2,
            Craft2 = 3,
            Warehouse = 4,
            DowngradeItem = 250,
            RedeemEquipment = 336,
            ClaimPrize = 337,
            VIPWarehouse = 341,
            TalismanUpgrade = 347,
            Breeder = 368,
            GemComposing = 422,
            Blessing = 426,
            TortoiseGemComposing = 438,
            RefineryStabilization = 448,
            ArtifactPurification = 455,
            ArtifactStabilization = 459,
            HorseRacingStore = 464,
            Reincarnation = 485,
            GarmentShop = 502
        }

        public enum CustomTypes : uint
        {
            SelectRecipiet = 30,
            JoinGuild = 34,
            MakeFriend = 38,
            ChatWhisper = 40,
            CloseClient = 43,
            HotKey = 53,
            Furniture = 54,
            TQForum = 79,
            PathFind = 97,
            LockItem = 102,
            ShowRevive = 1053,
            HideRevive = 1054,
            StatueMaker = 1066,
            MarriageMouse = 1067,
            GambleOpen = 1077,
            GambleClose = 1078,
            Compose = 1086,
            Craft1 = 1088,
            Craft2 = 1089,
            Warehouse = 1090,
            HPEnchant = 1091,
            ShoppingMallShow = 1100,
            ShoppingMallHide = 1101,
            NoOfflineTraining = 1117,
            LoginScreen = 1153,
            CenterClient = 1155,
            ClaimCP = 1197,
            ClaimAmount = 1198,
            MerchantApply = 1201,
            MerchantDone = 1202,
            RedeemEquipment = 1233,
            ClaimPrize = 1234,
            RepairAll = 1239,
            FlowerIcon = 1244,
            SendFlower = 1246,
            ReciveFlower = 1248,
            WarehouseVIP = 1272,
            UseExpBall = 1288,
            HackProtection = 1298,
            HideGUI = 1307,
            Inscribe = 3059,
            BuyPrayStone = 3069,
            HonorStore = 3104,
            Opponent = 3107,
            CountDownQualifier = 3109,
            QualifierStart = 3111,
            ItemsReturnedShow = 3117,
            ItemsReturnedWindow = 3118,
            ItemsReturnedHide = 3119,
            QuestFinished = 3147,
            QuestPoint = 3148,
            QuestPointSparkle = 3164,
            StudyPointsUp = 3192,
            Updates = 3218,
            IncreaseLineage = 3227,
            HorseRacingStore = 3245,
            GuildPKTourny = 3249,
            QuitPK = 3251,
            Spectators = 3252,
            CardPlayOpen = 3270,
            CardPlayClost = 3271,
            ArtifactPurification = 3344,
            SafeguardConvoyShow = 3389,
            SafeguardConvoyHide = 3390,
            RefineryStabilization = 3392,
            ArtifactStabilization = 3398,
            SmallChat = 3406,
            NormalChat = 3407,
            Reincarnation = 3439
        }
    }
}
